<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>后台登录</title>
	<!-- ZUI 标准版压缩后的 CSS 文件 -->
	<link rel="stylesheet" href="https://cdn.bootcss.com/zui/1.9.1/css/zui.min.css">
	<!-- ZUI Javascript 依赖 jQuery -->
	<script src="https://cdn.bootcss.com/zui/1.9.1/lib/jquery/jquery.js"></script>
	<!-- ZUI 标准版压缩后的 JavaScript 文件 -->
	<script src="https://cdn.bootcss.com/zui/1.9.1/js/zui.min.js"></script>
</head>
<body>
<div class="container-fluid" style="padding-top: 60px;">
<div class="panel panel-primary">
  <div class="panel-heading">
    后台登录
  </div>
  <div class="panel-body">
    <div class="input-control has-icon-left">
  		<input id="username" type="text" class="form-control" placeholder="用户名">
  		<label for="inputAccountExample1" class="input-control-icon-left"><i class="icon icon-user "></i></label>
	</div><br>
	<div class="input-control has-icon-left has-icon-right">
  		<input id="password" type="password" class="form-control" placeholder="密码">
  		<label for="inputPasswordExample1" class="input-control-icon-left"><i class="icon icon-key"></i></label>
	</div><br>
	<center>
	<button class="btn btn-primary" id="ok">登录</button></center>
  </div>
</div>
<script>
$("#ok").click(function(){
  //判断一下下
    $.post("../api.php?login",
    {
        username: $("#username").val(),
        password: $("#password").val()
    },
    function(data,status){
        var json = JSON.parse(data);
        if (json['code'] == 0) {
        	new $.zui.Messager(json['msg'], {
        		icon: 'bell' // 定义消息图标
    		}).show();
        }else{
        	new $.zui.Messager(json['msg'], {
        		icon: 'bell' // 定义消息图标
    		}).show();
        }
    });
});
</script>
</div>
</body>
</html>